package com.aabte.lota.auth.auth.token;

import io.jsonwebtoken.io.Encoder;
import io.jsonwebtoken.io.EncodingException;
import java.util.Base64;

/**
 * @author Daniel
 * @version 1.0
 * @date 2020/4/5
 */
public class JWTBase64Encoder implements Encoder<byte[], String> {

  private static final JWTBase64Encoder INSTANCE = new JWTBase64Encoder();

  public static JWTBase64Encoder getInstance() {
    return INSTANCE;
  }

  @Override
  public String encode(byte[] bytes) throws EncodingException {
    return Base64.getEncoder().encodeToString(bytes);
  }
}
